package com.mjlf.framework.mvc.eneity;

import java.util.Objects;

/**
 * 这个类中包括请求的方法，请求的路径
 */

public class RequestEntity {

    private String method;  //请求方法：GET,POST等
    private String requestPath; //请求路径

    public RequestEntity() {
    }

    public RequestEntity(String method, String requestPath) {
        this.method = method;
        this.requestPath = requestPath;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getRequestPath() {
        return requestPath;
    }

    public void setRequestPath(String requestPath) {
        this.requestPath = requestPath;
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || !(o instanceof RequestEntity)) {
            return false;
        }
        RequestEntity requestEntity = (RequestEntity) o;
        if (requestEntity.getMethod().equals(this.method) &&
                requestEntity.getRequestPath().equals(this.requestPath)) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return Objects.hash(method, requestPath);
    }

    @Override
    public String toString() {
        return "RequestEntity{" +
                "method='" + method + '\'' +
                ", requestPath='" + requestPath + '\'' +
                '}';
    }
}
